// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "WallActor.generated.h"

UENUM(BlueprintType)
enum class ELoopDirection : uint8
{
	X		UMETA(DisplayName = "X"),
	Y		UMETA(DisplayName = "Y"),
	NegX	UMETA(DisplayName = "-X"),
	NegY	UMETA(DisplayName = "-Y")
};

UCLASS()
class TIANZHU_API AWallActor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AWallActor();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	virtual void OnConstruction(const FTransform& Transform) override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	UFUNCTION(BlueprintCallable, Category = "Wall")
	void CreateWallLoop();

	UPROPERTY(EditAnywhere, Category = "Wall")
	UStaticMesh* WallMesh;

	UPROPERTY(EditAnywhere, Category = "Wall")
	int32 NumberOfWalls;

	UPROPERTY(EditAnywhere, Category = "Wall")
	float DistanceBetweenWalls;

	UPROPERTY(EditAnywhere, Category = "Wall")
	FVector MeshScale;

	UPROPERTY(EditAnywhere, Category = "Wall")
	ELoopDirection LoopDirection;


private:
	TArray<UStaticMeshComponent*> WallComponents;

	UPROPERTY()
	USceneComponent* RootSceneComponent;

	void CreateWallSegment(int32 Index);

};
